package com.wangxiaotao.springcloud.alibaba.controller;

import com.wangxiaotao.springcloud.alibaba.entity.CommonResult;
import com.wangxiaotao.springcloud.alibaba.service.AccountService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@Slf4j
@RequiredArgsConstructor
public class AccountController {
    private final AccountService storageService;

    @GetMapping(value = "/account/decrease")
    public CommonResult decrease(Long productId, BigDecimal money){
        storageService.decrease(productId,money);
        return new CommonResult(200,"扣减账户余额成功");
    }

}
